package com.zhiyou.crud.controller;

import com.zhiyou.crud.bean.Manage;
import com.zhiyou.crud.service.ManagesService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@Controller

public class ManagesController {

    @Resource
    ManagesService managesService;
    @RequestMapping("/admin/login")
    public String getManage(Manage manage, HttpSession session , Model model){

        if (manage.getMname() !=null&&manage.getMpassword() !=null){

            Manage getManage = managesService.getSelectManage(manage);
            System.out.println("getManage = " + getManage);
            if (getManage !=null){
             //成功
                session.setAttribute("manage",getManage);
                return "index";
            }

        }
            model.addAttribute("msg","登陆失败");
            return "/admin/admin_login";
    }



}
